from building import *

cwd = GetCurrentDir()

# init src and inc vars
src = []
inc = []

# add the general drivers.
src += Split("""
board.c
stm32f4xx_it.c
usart.c
drv_sdram.c
drv_rtc.c
drv_mpu.c
""")

# add dwin basic include
inc += [cwd]

# add sdio driver
if GetDepend('RT_USING_DFS'):
    src += ['drv_sdio_sd.c']

if GetDepend('RT_USING_MTD_NAND'):
    src += ['drv_nand.c']

# add Ethernet drivers.
if GetDepend('RT_USING_LWIP'):
    src += ['drv_eth.c', 'drv_pcf8574.c']

# add i2c drivers.
if GetDepend(['RT_USING_I2C']) or GetDepend('RT_USING_LWIP'):
    src += ['drv_i2c.c']

# add gpio drivers.
if GetDepend('RT_USING_PIN'):
    src += ['drv_gpio.c']

# add spi drivers.
if GetDepend('RT_USING_SPI'):
    src += ['drv_spi.c']

# add spi flash drivers.
if GetDepend('RT_USING_SFUD'):
    src += ['drv_spi_flash.c']

# add audio drivers.
if GetDepend('RT_USING_SAI_AUDIO'):
    src += Glob('./audio/*.c')
    inc += [cwd + "/audio"] 

# add lcd drivers.
if GetDepend('PKG_USING_GUIENGINE'):
    src += ['drv_lcd.c']

if GetDepend(['BSP_USING_USBD']):
    src += ['drv_usbd.c']


if GetDepend(['BSP_USING_USBH']):
    src += ['drv_usbh.c']    

group = DefineGroup('Drivers', src, depend = [''], CPPPATH = inc)

Return('group')
